package com.meida.boot.handler;

import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.interceptor.SaveInterceptor;
import com.meida.common.mybatis.query.CriteriaSave;
import com.meida.common.security.OpenHelper;
import com.meida.module.user.client.entity.AppUser;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

/**
 * @author flyme
 * @date 2019/8/4 10:01
 * @des 用户注册扩展
 */

@Component("userSaveHandler")
@Log4j2
public class UserSaveHandler implements SaveInterceptor<AppUser> {


    @Override
    public void prepare(CriteriaSave cs, EntityMap params, AppUser appUser) {
        Long companyId = OpenHelper.getCompanyId();
        cs.put("companyId", companyId);
        cs.put("userType", "USER");
    }

}
